home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / etc / init.d / usplash < prev    next >
Encoding:
Text File  |  2007-02-23  |  2.1 KB  |  85 lines

  1. #! /bin/sh
  2. # The usplash script makes sure that usplash exits at the end of 
  3. # the boot sequence and re-run the console-screen.sh script to make
  4. # sure that the console fonts are actually set
  5. #
  6. #        Written by Miquel van Smoorenburg <miquels@cistron.nl>.
  7. #        Modified for Debian 
  8. #        by Ian Murdock <imurdock@gnu.ai.mit.edu>.
  9. #
  10. # Version:    @(#)skeleton  1.9  26-Feb-2001  miquels@cistron.nl
  11. #
  12.  
  13. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  14. DAEMON=/sbin/usplash
  15. NAME=usplash
  16. DESC="Userspace bootsplash utility"
  17.  
  18. test -x $DAEMON || exit 0
  19.  
  20. set -e
  21.  
  22. usplash_quit() {
  23.     # first some sanity checks if we actually have usplash on the system
  24.     # 
  25.     # check if usplash is runing and if it does, exit it
  26.     # then re-run console-screen.sh because it can't set console-fonts
  27.     # properly while the screen is in graphics mode
  28.     # 
  29.     # also check if we are ended up in console 8. This means that 
  30.     # no gdm/kdm/xdm was started (otherwise we would be on vt7).
  31.     # It happens when e.g. usplash timed out
  32.     if type setupcon >/dev/null 2>&1; then
  33.         CONSOLE_SCREEN=
  34.     elif [ -x /etc/init.d/console-screen.sh ]; then
  35.         CONSOLE_SCREEN=/etc/init.d/console-screen.sh
  36.     else
  37.         CONSOLE_SCREEN=
  38.     fi
  39.     if type usplash >/dev/null 2>&1 && grep -q splash /proc/cmdline &&
  40.            ( pidof usplash > /dev/null || [ "$(fgconsole 2>/dev/null)" = "8" ] ); then
  41.            # Clear VT 8 of any console messages
  42.         clear >/dev/tty8
  43.  
  44.         # ask usplash to go away
  45.         usplash_write QUIT
  46.  
  47.         # wait until it is really gone or kill it if it dosn't exit
  48.         i=0
  49.         while pidof usplash > /dev/null; do
  50.             i=$(($i + 1))
  51.             if [ $i -gt 10 ]; then
  52.                 kill -9 `pidof usplash`
  53.                 break
  54.             fi
  55.             sleep 1
  56.         done
  57.  
  58.         # reset all our virtual consoles, yay!
  59.         if [ "$CONSOLE_SCREEN" ]; then
  60.             $CONSOLE_SCREEN
  61.         fi
  62.         if [ "$(fgconsole 2>/dev/null)" = "8" ] && [ "$DO_NOT_SWITCH_VT" != "yes" ]; then
  63.             chvt 1
  64.         fi
  65.     fi
  66. }
  67.  
  68. case "$1" in
  69.   start)
  70.     usplash_quit
  71.     ;;
  72.   stop)
  73.     usplash_write "TIMEOUT 15"
  74.     ;;
  75.   *)
  76.     N=/etc/init.d/$NAME
  77.     # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
  78.     echo "Usage: $N {start|stop}" >&2
  79.     exit 1
  80.     ;;
  81. esac
  82.  
  83. exit 0
  84.